import config from "@/config"
import http from "@/utils/request"
import { QueryRoleDto, RoleSaveDto, RoleDelDto, RoleVo } from './types'
import { ApiResult } from '@/api/common/ApiResultType'
import PageViewModel from '../common/PageViewType'
export default {
	/**
	 * 获取所有角色信息
	 */
	GetRoles: {
		url: `${config.API_URL}/sysrole/GetRoles`,
		name: "获取所有角色信息",
		post: async function (data: QueryRoleDto) {
			var res: PageViewModel = await http.post(this.url, data);
			return res;
		}
	},
	/**
	 * 角色保存
	 */
	rolesave: {
		url: `${config.API_URL}/sysrole/rolesave`,
		name: "获取所有角色信息",
		post: async function (data: RoleSaveDto) {
			var res: ApiResult = await http.post(this.url, data);
			return res;
		}
	},
	/**
	 * 删除角色
	 */
	roledel: {
		url: `${config.API_URL}/sysrole/roledel`,
		name: "删除角色信息",
		post: async function (data: RoleDelDto) {
			var res: ApiResult = await http.post(this.url, data);
			return res;
		}
	},
	/**
	 * 通过Id获取角色信息
	 */
	getRoleById: {
		url: `${config.API_URL}/sysrole/getRoleById`,
		name: "通过Id获取角色信息",
		get: async function (Id: string) {
			var res: RoleVo = await http.get(this.url + "?Id=" + Id);
			return res;
		}
	}
}
